<?php

namespace Api\Model;
use Think\Model;
class UsersModel extends Model {

    function addUser($username, $password, $salt, $email, $deviceid, $group) {
        $data = array(
            'username' => $username,
            'password' => $password,
            'salt' => $salt,
            'email' => $email,
            'deviceid' => $deviceid,
            'group' => $group,
            'createtime' => date('Y-m-d H:i:s', time())
        );
        return $this->data($data)->add();
    }

    function upUser($user_id, $data) {
        return $this->where('id = ' . $user_id)->save($data);
    }
    
    function findUserbyId($id){
        $where=array('id'=>$id);
        return $this->where($where)->limit(1)->find();
    }

}
